package com.ruoyi.channelApi;

import com.ruoyi.channel.service.ChannelCommonService;
import com.ruoyi.channelApi.domain.common.ChannelCheckRequest;
import com.ruoyi.channelApi.domain.common.ChannelCommonRequest;
import com.ruoyi.channelApi.domain.common.ChannelSourceRegister;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RequiredArgsConstructor
@RestController
@RequestMapping("/api/channelApi")
public class ChannelCommonController {
    private final ChannelCommonService channelCommonService;

    @PostMapping("/crm")
    public Map<String, Object> crm(@RequestBody ChannelCommonRequest channelRequest) {
        return channelCommonService.savePushInfoBySource(channelRequest);
    }

    @PostMapping("/checkCrm")
    public Map<String, Object> checkCrm(@RequestBody ChannelCheckRequest checkRequest) {
        return channelCommonService.checkTelBySource(checkRequest);
    }

    @PostMapping("/registerSource")
    public Map<String, Object> registerSource(@RequestBody ChannelSourceRegister register) {
        return channelCommonService.registerChannelSource(register);
    }
}
